import React from "react";
import { Link } from "react-router-dom";

export default function Pager({ pageCount, pageNum }) {
  console.log("分页条：", pageCount, pageNum);
  return (
    <div className="pages">
      {/* 上一页 */}
      <Link to="./#" className={pageNum === 1 ? "default" : undefined}>
        上一页
      </Link>
      {/*<a href="" className="cur">1</a>*/}
      {/*<a href="">2</a>*/}
      {/*<a href="">3</a>*/}
      {/* 当前页 */}
      <Link to="./#" className="cur">
        {pageNum}
      </Link>
      {/* 当前页+1 */}
      {pageNum + 1 <= pageCount && <Link to="./#">{pageNum + 1}</Link>}
      {/* 当前页+2 */}
      {pageNum + 2 <= pageCount && <Link to="./#">{pageNum + 2}</Link>}
      {/* 下一页 */}
      <Link to="./#" className={pageNum === pageCount ? "default" : undefined}>
        下一页
      </Link>
    </div>
  );
}
